package com.cyf.db.mapper;


import com.cyf.db.bean.AppUserPay;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AppUserPayMaper {


    @Insert("insert into app_user_pay (plate,createTime,userId) values (#{pay.plate},#{pay.createTime},#{pay.userId}) ")
    void insertAppUserPay(@Param("pay") AppUserPay pay);

    @Select("select * from app_user_pay where userId = #{userId} ORDER BY createTime ")
    List<AppUserPay> selectAppUserPayByUserId(@Param("userId") Integer userId);

    @Select("select  * from app_user_pay where userId = #{userId} and  plate = #{plate}")
    AppUserPay getByPlateAndUserId(@Param("userId") Integer userId,@Param("plate") String plate);

    @Select("DELETE FROM app_user_pay WHERE id = #{id} ")
    void deleteAppUserPayById(@Param("id") Integer id);


    @Delete("delete from app_user_pay where userId = #{userId} and  plate = #{plate}")
    void deleteAppUserPayByUserId(@Param("userId") Integer userId,@Param("plate") String plate);

}
